package com.wei.util;

public class AS implements Count{
    static char arr[]={'+','-'};
    String s;
    double sum;

    public String  calculate(){
        int x = (int) (Math.random() * 2);
        int number1 =(int) (Math.random() * 101);
        int number2 = (int)(Math.random() * 101);//获取两个随机数
        s =  number1 +""+ arr[x] + number2+"=";
        if(x==0){
            sum=number1+number2;//再次借用一个随机数，利用该随机数可以随机生成加减
        }else{
            sum=number1-number2;
        }
        return s;
    }
    public  double answer(){//获取加减的结果
        return sum;
    }
}
